package com.ffyc.ssm.service;

import com.ffyc.ssm.dao.LoginDao;
import com.ffyc.ssm.modle.Admin;
import com.ffyc.ssm.modle.Menu;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class LoginService {

     @Autowired
     LoginDao loginDao;

     @Transactional
     public Admin login(Admin admin){
          admin.setPassword(DigestUtils.md2Hex(admin.getPassword()));
       return loginDao.login(admin);
     }
     @Transactional
     public List<Menu> menulist(Admin admin) {
          return loginDao.menulist(admin);
     }
}
